package com.qingzhuge.member.autoconfigure;

import com.qingzhuge.member.interceptor.AuthorizationTokenIntercepter;
import com.qingzhuge.web.interceptor.BaseAuthorizationInterceptor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import static com.qingzhuge.autoconfigure.QingTingProperties.PREFIX;

/**
 * @author : zero.xiao
 * @description : 资源映射
 * @date :2018/6/8 0008 下午 15:24
 * @since : 1.0.0
 * @modified :
 */
@Configuration
public class WebApiApplictionConfig {
    private static Logger log = LoggerFactory.getLogger(WebApiApplictionConfig.class);
    @Bean
    @ConditionalOnProperty(prefix = PREFIX+".jwt", value  = "auth-open", havingValue = "true")
    public BaseAuthorizationInterceptor authorizationInterceptor(){
        log.debug("开启jwt权限验证,声明过滤器...");
        return new AuthorizationTokenIntercepter();
    }
}